<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fy.model.Student" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>信息查询结果</title>
		<meta name="keywords" content="学生,信息,管理,系统">
		<meta name="description" content="学生信息管理系统">
		<%@ include file="../public/head.jspf"%>
	</head>
	<body>
		<div class="box">
			<h1>学生信息管理系统<a class="back">返回</a></h1>
			<div class="content">
				<div id="data">
					<table id="datalist">
						<caption>符合条件的学生信息</caption>
						<tr>
							<th>学号</th>
							<th>姓名</th>
							<th>年龄</th>
							<th>性别</th>
							<th>专业</th>
							<th>操作</th>
						</tr>
				    	<%
				    		response.setCharacterEncoding("UTF-8");
				    		request.setCharacterEncoding("UTF-8");
				    		ArrayList<Student> result = new ArrayList<Student>();
				    		result = (ArrayList<Student>) request.getAttribute("result");
				    		if (!result.isEmpty()) {
				    			for (int i = 0; i < result.size(); i++) {
				    				Student st = result.get(i);
				    				out.println("<tr>");
			    	    			out.println("							<td>" + st.getId() + "</td>");
			    	    			out.println("							<td>" + st.getName() + "</td>");
			    	    			out.println("							<td>" + st.getAge() + "</td>");
			    	    			out.println("							<td>" + st.getGender() + "</td>");
			    	    			out.print("							<td>" + st.getMajor() + "</td>");
				    	%>
							<td class="td_modi">
								<input type="button" value="删除" class="btn red"
									onclick="if(confirm('确定要删除此记录吗？')==true)location.href='students?methodName=2&id=<%=st.getId()%>'" />
								<input type="button" value="修改" class="btn green"
									onclick="location.href='students?methodName=4&id=<%=st.getId()%>'" />
							</td>
					    <% 
									out.print("</tr>");
								}
							}
					     %>
					     <tr>
							<td colspan="6">
								<input type="button" class="btn blue" value="查看列表"
									onclick="location.href='students?methodName=1'" />
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</body>
</html>